package com.suyang.syt.listener;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import cn.org.rapid_framework.web.httpinclude.HttpInclude;
import freemarker.ext.servlet.IncludePage;

public class ShareRenderArgsVariableInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		String viewName = modelAndView.getViewName();
		if (viewName != null && !viewName.startsWith("redirect:")) {
			modelAndView.addObject("httpInclude", new HttpInclude(request, response));
			// freemarker 原生的IncludePage指令
			modelAndView.addObject("include_page", new IncludePage(request, response));
		}
	}

}